package principal;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.applet.*;

import javax.sound.sampled.AudioSystem;
import javax.sound.sampled.UnsupportedAudioFileException;

import sun.audio.AudioPlayer;
import sun.audio.AudioStream;

public class Som {
	
	String nome;
	AudioClip player;
	
	//InputStream in;
	//AudioStream as;
	
	public Som(String file){
		String[] nomeInteiro;
		try {
			URL soundToPlay = getClass().getResource(file);
			player = Applet.newAudioClip(soundToPlay);
			
			//InputStream in = new FileInputStream(file);
			//AudioStream as = new AudioStream(in);
			
			nomeInteiro = file.split(".au");
			nome = nomeInteiro[0];
		} catch (Exception e) {}
	}
	
	public void playFile() {
		//AudioPlayer.player.start(as);
		player.play();
	}
}